`timescale 1ns/1ns
`define HASH_WIDTH 1024 
`define DATA_WIDTH 256
`define SHA512_TEST		"UsLYQLDnOnDE7HK3RHTlfQT4KKojiu4ZsTbrnfeosxllhAUPi0oySqSUULJv70czlZkFTGPHVuO5UUX56fzylgChHQtLx2Mbn4iu3KB80VQHbVVq"
`define SHA512_TEST_PADDING	{1'b1,127'b0,896'b0,128'd896}	// 896 bit
`define SHA512_TEST_RESULT	256'hbafcc23a6714a8fd2d591fbcf8453e94e96163faecd5ae84f5471dde8bc7d4d2


module testtop_ecc_core;
reg clk,rst_n,curve_sel,Start;
wire Done;
reg [2:0] FunSel;
reg [`DATA_WIDTH-1:0] dA,PA_x,PA_y,/*G_x,G_y,*//*a,p,n,*/random_k,s_verify,r_verify;
wire [`DATA_WIDTH-1:0] s,r;
reg [`HASH_WIDTH-1:0] sha512_M;
reg sha512_first_round,sha512_last_round,sha512_start;
wire bingo;
wire [2:0] State;
//reg [2047:0] all_message;

top_ecc_core ecc(clk,rst_n,curve_sel,Start,Done,FunSel,dA,PA_x,PA_y,/*G_x,G_y,*//*a,p,n,*/random_k,s_verify,r_verify,s,r,sha512_M,sha512_first_round,sha512_last_round,sha512_start,bingo,State);

initial
begin
clk=0;
rst_n=1;
Start=0;
sha512_start=1;
#20 rst_n=0;
#20 rst_n=1;
#20 Start=1;
#20 Start=0;
end

always #10 clk = ~clk;

initial
begin

curve_sel = 1'b0;
FunSel = 3'b000;
//FunSel = 3'b001;
//FunSel = 3'b010;
//FunSel = 3'b011;
//a=256'hffffffff00000001000000000000000000000000fffffffffffffffffffffffc;
//p=256'hffffffff00000001000000000000000000000000ffffffffffffffffffffffff;
//n=256'hFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551;

dA =256'h9d350545a4626840a66008e70c8d5f92e5c0d27a5902bd2a9d3b43600a4ca0c1;
PA_x=256'h84a30bc31184f3e4a89dfb346aa8f91c120590f1d15b2aac5c6f1fbab9186936;
PA_y=256'h51b693bbc147de3499aa139d54da79b6d679f28e204b5cfc632401015bcaa3ff;
//G_x=256'h6B17D1F2_E12C4247_F8BCE6E5_63A440F2_77037D81_2DEB33A0_F4A13945_D898C296;
//G_y=256'h4FE342E2_FE1A7F9B_8EE7EB4A_7C0F9E16_2BCE3357_6B315ECE_CBB64068_37BF51F5;
random_k=256'h16a25a3d8e495e9efeeb31ce49e0f38e0d00828ef8b0c6b42b81145803f0b21f;
s_verify=256'hccb9d638172b915409af3a0c4de71d6906bea05c4f7fe6b35e81b011c474e1aa;
r_verify=256'he1f8048b333a4eac79a79e5c6ebe17e1b17fc463dc352db1c188c152f876e916;

//all_message = {`SHA512_TEST,`SHA512_TEST_PADDING};
//sha512_m=all_message[1023:0];
sha512_M="Hello!";
sha512_first_round=1'b1;
sha512_last_round=1'b1;

end

endmodule

